.TH "dcmsend" 1 "Wed Dec 11 2024" "Version 3.6.9" "OFFIS DCMTK" \" -*- nroff -*-
.nh
.SH NAME
dcmsend \- Simple DICOM storage SCU (sender)

.SH "SYNOPSIS"
.PP
.PP
.nf
dcmsend [options] peer port dcmfile-in...
.fi
.PP
.SH "DESCRIPTION"
.PP
The \fBdcmsend\fP application implements a Service Class User (SCU) for the Storage Service Class\&. In contrast to the well-known \fBstorescu\fP utility, \fBdcmsend\fP has less options and is, therefore, easier to use - this also explains the term 'simple' in the title\&. The main purpose of this application is to send a whole bunch of DICOM files to a Storage Service Class Provider (SCP)\&. \fBdcmsend\fP supports both multiple associations (one after the other) and decompression of DICOM SOP instances if needed to transfer them\&.
.SH "PARAMETERS"
.PP
.PP
.nf
peer        hostname of DICOM peer

port        tcp/ip port number of peer

dcmfile-in  DICOM file or directory to be transmitted
.fi
.PP
.SH "OPTIONS"
.PP
.SS "general options"
.PP
.nf
  -h    --help
          print this help text and exit

        --version
          print version information and exit

        --list-decoders
          list transfer syntaxes of decoders and exit

        --arguments
          print expanded command line arguments

  -q    --quiet
          quiet mode, print no warnings and errors

  -v    --verbose
          verbose mode, print processing details

  -d    --debug
          debug mode, print debug information

  -ll   --log-level  [l]evel: string constant
          (fatal, error, warn, info, debug, trace)
          use level l for the logger

  -lc   --log-config  [f]ilename: string
          use config file f for the logger

  +v    --verbose-pc
          show presentation contexts in verbose mode
.fi
.PP
.SS "input options"
.PP
.nf
input file format:

  +f    --read-file
          read file format or data set

  +fo   --read-file-only
          read file format only (default)

  -f    --read-dataset
          read data set without file meta information

input files:

  +rd   --read-from-dicomdir
          read information on input files from DICOMDIR

  +sd   --scan-directories
          scan directories for input files (dcmfile-in)

  +sp   --scan-pattern  [p]attern: string (only with --scan-directories)
          pattern for filename matching (wildcards)

          # possibly not available on all systems

  -r    --no-recurse
          do not recurse within directories (default)

  +r    --recurse
          recurse within specified directories
.fi
.PP
.SS "processing options"
.PP
.nf
transfer syntax conversion:

  -dn   --decompress-never
          never decompress compressed data sets

  +dls  --decompress-lossless
          only decompress lossless compression (default)

  +dly  --decompress-lossy
          decompress both lossy and lossless compression

deflate compression level:

  +cl   --compression-level  [l]evel: integer (default: 6)
          0=uncompressed, 1=fastest, 9=best compression

other processing options:

  -nh   --no-halt
          do not halt on first invalid input file
          or if unsuccessful store encountered

  -nip  --no-illegal-proposal
          do not propose any presentation context that does
          not contain the default transfer syntax (if needed)

  -nuc  --no-uid-checks
          do not check UID values of input files
.fi
.PP
.SS "network options"
.PP
.nf
IP protocol version:

  -i4   --ipv4
          use IPv4 only (default)

  -i6   --ipv6
          use IPv6 only

  -i0   --ip-auto
          use DNS lookup to determine IP protocol

application entity titles:

  -aet  --aetitle  [a]etitle: string
          set my calling AE title (default: DCMSEND)

  -aec  --call  [a]etitle: string
          set called AE title of peer (default: ANY-SCP)

association handling:

  +ma   --multi-associations
          use multiple associations (one after the other)
          if needed to transfer the instances (default)

  -ma   --single-association
          always use a single association

other network options:

  -to   --timeout  [s]econds: integer (default: unlimited)
          timeout for connection requests

  -ta   --acse-timeout  [s]econds: integer (default: 30)
          timeout for ACSE messages

  -td   --dimse-timeout  [s]econds: integer (default: unlimited)
          timeout for DIMSE messages

  -pdu  --max-pdu  [n]umber of bytes: integer (4096..131072)
          set max receive pdu to n bytes (default: 16384)

        --max-send-pdu  [n]umber of bytes: integer (4096..131072)
          restrict max send pdu to n bytes
.fi
.PP
.SS "output options"
.PP
.nf
general:

  +crf  --create-report-file  [f]ilename: string
          create a detailed report on the transfer
          (if successful) and write it to text file f
.fi
.PP
.SH "NOTES"
.PP
.SS "Typical Usage"
A typical use case of \fBdcmsend\fP is to send arbitrary SOP instances that are stored as DICOM files to a storage SCP\&. The following command does exactly this:
.PP
.PP
.nf
dcmsend --verbose <peer> <port> *.dcm
.fi
.PP
.PP
If the DICOM files are stored in a hierarchy of directories below the directory 'IMAGES', the following command can be used:
.PP
.PP
.nf
dcmsend -v <peer> <port> --scan-directories --recurse IMAGES
.fi
.PP
.PP
It is also possible to specify multiple directories and to combine the aforementioned approaches (using both file and directory names):
.PP
.PP
.nf
dcmsend -v +sd +r <peer> <port> IMAGES_1 IMAGES_2 test.img *.dcm
.fi
.PP
.PP
If the SOP instances are referenced from a DICOMDIR file, option \fI--read-from-dicomdir\fP (or \fI+rd\fP) can be used to send all referenced DICOM files without loading them already for the association negotiation:
.PP
.PP
.nf
dcmsend -v <peer> <port> --read-from-dicomdir DICOMDIR
.fi
.PP
.PP
And again, all of the above approaches can be combined like this:
.PP
.PP
.nf
dcmsend -v +sd +r +rd <peer> <port> IMAGES_1 IMAGES_2 test.img DICOMDIR *.dcm
.fi
.PP
.PP
The default option \fI--read-file-only\fP makes sure that only DICOM files (i\&.e\&. the ones with meta-header and magic word 'DICM' after the preamble) are processed\&. Usually, if processing a whole bunch of files, it is also a good idea not to halt on the first invalid input file or if an unsuccessful store was encountered\&. This can be accomplished by using option \fI--no-halt\fP\&. Please note, however, that 'unsuccessful store' does not mean that the DIMSE status of the C-STORE response indicates an error\&. It means that the C-STORE request could not be sent to the storage SCP\&.
.PP
If more than 128 Presentation Contexts are needed, which is the maximum number allowed according to the DICOM standard, a new association is started after the previous one has been completed\&. In cases where this behavior is unwanted, it can be disabled using option \fI--single-association\fP\&. In addition, whether only lossless compressed data sets are decompressed (if needed), which is the default, or also lossy compressed data sets can be specified using the \fI--decompress-xxx\fP options\&.
.PP
In order to get both an overview and detailed information on the transfer of the DICOM SOP instances, option \fI--create-report-file\fP can be used to create a corresponding text file\&. However, this file is only created as a final step if the application did not terminate before (with an error)\&.
.SS "Scanning Directories"
Adding directories as a parameter to the command line only makes sense if option \fI--scan-directories\fP is also given\&. If the files in the provided directories should be selected according to a specific name pattern (e\&.g\&. using wildcard matching), option \fI--scan-pattern\fP has to be used\&. Please note that this file pattern only applies to the files within the scanned directories, and, if any other patterns are specified on the command line outside the \fI--scan-pattern\fP option (e\&.g\&. in order to select further files), these do not apply to the specified directories\&.
.PP
Thus, the third of the above examples will recurse over directories IMAGES_1 and IMAGES_2 and transmit files that are contained in these two folders and all their subfolders (due to option \fI+r\fP)\&. Additionally, \fBdcmsend\fP will transfer 'test\&.img' and all files with extension 'dcm' from the current working folder\&. Note that providing directory names without enabling option \fI+sd\fP does not make sense\&.
.SS "DICOM Conformance"
Basically, the \fBdcmsend\fP application supports all Storage SOP Classes as an SCU, including private ones\&. By default, the application checks the SOP Class UID of the DICOM file in order to make sure that only valid SOP instances are sent\&. With option \fI--no-uid-checks\fP this check can be disabled\&.
.PP
The \fBdcmsend\fP application also supports all Transfer Syntaxes that are defined in the DICOM standard\&. Private Transfer Syntaxes can only be used if the UID check is disabled with option \fI--no-uid-checks\fP\&. Please note, however, that only a limited number of Transfer Syntaxes are supported for converting them to the DICOM Default Transfer Syntax (Implicit VR Little Endian)\&. With option \fI--list-decoders\fP the Transfer Syntaxes supported natively or by decoders are listed\&. The output typically looks like the following:
.PP
.PP
.nf
Transfer Syntaxes supported natively:
- Little Endian Implicit
- Little Endian Explicit
- Big Endian Explicit

Transfer Syntaxes supported by decoders:
- Deflated Explicit VR Little Endian
- JPEG Baseline
- JPEG Extended, Process 2+4
- JPEG Spectral Selection, Non-hierarchical, Process 6+8
- JPEG Full Progression, Non-hierarchical, Process 10+12
- JPEG Lossless, Non-hierarchical, Process 14
- JPEG Lossless, Non-hierarchical, 1st Order Prediction
- JPEG-LS Lossless
- JPEG-LS Lossy (Near-lossless)
- RLE Lossless
.fi
.PP
.PP
Since \fBdcmsend\fP tries to be as simple as possible for the user, by default Presentation Contexts might be proposed to the SCP that are strictly speaking 'illegal'\&. This is because, according to the DICOM standard, the SCU always has to propose the DICOM Default Transfer Syntax in at least one Presentation Context associated with each abstract syntax (i\&.e\&. SOP class)\&. This requirement is waived if the SCU only has access to the SOP instance in lossy compressed form or if the decompressed pixel data would be too large to be encoded\&. With option \fI--no-illegal-proposal\fP the strict DICOM-conformant behavior can be enforced, i\&.e\&. no possibly illegal Presentation Context will be proposed but the corresponding SOP instance will be rejected (if needed)\&. Please note, however, that the size of the decompressed pixel data is not checked\&.
.PP
The default Transfer Syntax for 'Lossless JPEG Compression', 'Lossy JPEG
Compression' and so on are not always proposed as also required by the DICOM standard\&. The same limitation applies to other compression schemes\&. See DICOM PS 3\&.5 section 10 for details\&.
.SH "LOGGING"
.PP
The level of logging output of the various command line tools and underlying libraries can be specified by the user\&. By default, only errors and warnings are written to the standard error stream\&. Using option \fI--verbose\fP also informational messages like processing details are reported\&. Option \fI--debug\fP can be used to get more details on the internal activity, e\&.g\&. for debugging purposes\&. Other logging levels can be selected using option \fI--log-level\fP\&. In \fI--quiet\fP mode only fatal errors are reported\&. In such very severe error events, the application will usually terminate\&. For more details on the different logging levels, see documentation of module 'oflog'\&.
.PP
In case the logging output should be written to file (optionally with logfile rotation), to syslog (Unix) or the event log (Windows) option \fI--log-config\fP can be used\&. This configuration file also allows for directing only certain messages to a particular output stream and for filtering certain messages based on the module or application where they are generated\&. An example configuration file is provided in \fI<etcdir>/logger\&.cfg\fP\&.
.SH "COMMAND LINE"
.PP
All command line tools use the following notation for parameters: square brackets enclose optional values (0-1), three trailing dots indicate that multiple values are allowed (1-n), a combination of both means 0 to n values\&.
.PP
Command line options are distinguished from parameters by a leading '+' or '-' sign, respectively\&. Usually, order and position of command line options are arbitrary (i\&.e\&. they can appear anywhere)\&. However, if options are mutually exclusive the rightmost appearance is used\&. This behavior conforms to the standard evaluation rules of common Unix shells\&.
.PP
In addition, one or more command files can be specified using an '@' sign as a prefix to the filename (e\&.g\&. \fI@command\&.txt\fP)\&. Such a command argument is replaced by the content of the corresponding text file (multiple whitespaces are treated as a single separator unless they appear between two quotation marks) prior to any further evaluation\&. Please note that a command file cannot contain another command file\&. This simple but effective approach allows one to summarize common combinations of options/parameters and avoids longish and confusing command lines (an example is provided in file \fI<datadir>/dumppat\&.txt\fP)\&.
.SH "EXIT CODES"
.PP
The \fBdcmsend\fP utility uses the following exit codes when terminating\&. This enables the user to check for the reason why the application terminated\&.
.SS "general"
.PP
.nf
EXITCODE_NO_ERROR                         0
EXITCODE_COMMANDLINE_SYNTAX_ERROR         1
.fi
.PP
.SS "input file errors"
.PP
.nf
EXITCODE_CANNOT_READ_INPUT_FILE          20 (*)
EXITCODE_NO_INPUT_FILES                  21
EXITCODE_INVALID_INPUT_FILE              22
EXITCODE_NO_VALID_INPUT_FILES            23
.fi
.PP
.SS "output file errors"
.PP
.nf
EXITCODE_CANNOT_WRITE_OUTPUT_FILE        40 (*)
EXITCODE_CANNOT_WRITE_REPORT_FILE        43
.fi
.PP
.SS "network errors"
.PP
.nf
EXITCODE_CANNOT_INITIALIZE_NETWORK       60
EXITCODE_CANNOT_NEGOTIATE_ASSOCIATION    61
EXITCODE_CANNOT_SEND_REQUEST             62
EXITCODE_CANNOT_ADD_PRESENTATION_CONTEXT 65
.fi
.PP
.PP
(*) Actually, these codes are currently not used by \fBdcmsend\fP but serve as a placeholder for the corresponding group of exit codes\&.
.SH "ENVIRONMENT"
.PP
The \fBdcmsend\fP utility will attempt to load DICOM data dictionaries specified in the \fIDCMDICTPATH\fP environment variable\&. By default, i\&.e\&. if the \fIDCMDICTPATH\fP environment variable is not set, the file \fI<datadir>/dicom\&.dic\fP will be loaded unless the dictionary is built into the application (default for Windows)\&.
.PP
The default behavior should be preferred and the \fIDCMDICTPATH\fP environment variable only used when alternative data dictionaries are required\&. The \fIDCMDICTPATH\fP environment variable has the same format as the Unix shell \fIPATH\fP variable in that a colon (':') separates entries\&. On Windows systems, a semicolon (';') is used as a separator\&. The data dictionary code will attempt to load each file specified in the \fIDCMDICTPATH\fP environment variable\&. It is an error if no data dictionary can be loaded\&.
.SH "SEE ALSO"
.PP
\fBdcmrecv\fP(1), \fBstorescu\fP(1), \fBstorescp\fP(1)
.SH "COPYRIGHT"
.PP
Copyright (C) 2011-2024 by OFFIS e\&.V\&., Escherweg 2, 26121 Oldenburg, Germany\&.
